# coding: utf-8
'''A module containing a lot of data that BottleCap uses for it's actions.
############################################################################
#    DANGER! Falling rocks!                                                #
#                                                                          #
#     With all politeness, unless you're going to be making some edits to  #
#    the main body of the script, or to the aol variable, don't touch this #
#    file. If you find a new thing to be added to the aol variable, tell   #
#    me. I'll *possibly* add it.                                           #
#                                                                          #
#    Sorry guys, it's Her Royal Highness's English, colour is spelt such   #
#   and not 'color'; I'm not changing this, but might release a en_US      #
#   version at some point.                                                 #
############################################################################'''

############################################################################
#    Copyright (C) 2006 by Robert Small                                    #
#    SmallR2002@Gmail.com                                                  #
#                                                                          #
#    This program is free software; you can redistribute it and#or modify  #
#    it under the terms of the GNU General Public License as published by  #
#    the Free Software Foundation; either version 2 of the License, or     #
#    (at your option) any later version.                                   #
#                                                                          #
#    This program is distributed in the hope that it will be useful,       #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#    GNU General Public License for more details.                          #
#                                                                          #
#    You should have received a copy of the GNU General Public License     #
#    along with this program; if not, write to the                         #
#    Free Software Foundation, Inc.,                                       #
#    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             #
############################################################################

############################################################################
#    DANGER! Falling rocks!                                                #
#                                                                          #
#     With all politeness, unless you're going to be making some edits to  #
#    the main body of the script, or to the aol variable, don't touch this #
#    file. If you find a new thing to be added to the aol variable, tell   #
#    me. I'll *possibly* add it.                                           #
#                                                                          #
#    Sorry guys, it's Her Royal Highness's English, colour is spelt such   #
#   and not 'color'; I'm not changing this, but might release a en_US      #
#   version at some point.                                                 #
############################################################################

__module_name__        = "bcmisc"
__module_version__     = "0.0.1"
__module_description__ = "A module containing a lot of data that BottleCap uses for it's actions."

import time

################################################################################################
################################################################################################
#                               HIGHLIGHT/AWAY RELATED DEFAULTS                                #
################################################################################################

#  Last commands starting value(s)
last_commands_time = time.time()

#  Highlight related starting value(s)
highlight_response_count = 0
highlight_last_room = ""
highlight_last_person = ""
highlight_last_time = time.time()

################################################################################################
################################################################################################
#                           STARTING, ENDING, AND WITHIN VARIABLES                             #
################################################################################################

#  URL detection internals; if you don't know what it does, don't touch it!

starters = [ "www", "http://", "https://" ]
tlds = [ ".arpa", ".root", ".aero", ".biz", ".cat", ".com", ".coop", ".edu", ".gov", ".info", ".int", ".jobs", ".mil", ".mobi", ".museum", ".name", ".net", ".org", ".pro", ".travel", ".ac", ".ad", ".ae", ".af", ".ag", ".ai", ".al", ".am", ".an", ".ao", ".aq", ".ar", ".as", ".at", ".au", ".aw", ".az", ".ba", ".bb", ".bd", ".be", ".bf", ".bg", ".bh", ".bi", ".bj", ".bm", ".bn", ".bo", ".br", ".bs", ".bt", ".bv", ".bw", ".by", ".bz", ".ca", ".cc", ".cd", ".cf", ".cg", ".ch", ".ci", ".ck", ".cl", ".cm", ".cn", ".co", ".cr", ".cu", ".cv", ".cx", ".cy", ".cz", ".de", ".dj", ".dk", ".dm", ".do", ".dz", ".ec", ".ee", ".eg", ".er", ".es", ".et", ".eu", ".fi", ".fj", ".fk", ".fm", ".fo", ".fr", ".ga", ".gb", ".gd", ".ge", ".gf", ".gg", ".gh", ".gi", ".gl", ".gm", ".gn", ".gp", ".gq", ".gr", ".gs", ".gt", ".gu", ".gw", ".gy", ".hk", ".hm", ".hn", ".hr", ".ht", ".hu", ".id", ".ie", ".il", ".im", ".in", ".io", ".iq", ".ir", ".is", ".it", ".je", ".jm", ".jo", ".jp", ".ke", ".kg", ".kh", ".ki", ".km", ".kn", ".kr", ".kw", ".ky", ".kz", ".la", ".lb", ".lc", ".li", ".lk", ".lr", ".ls", ".lt", ".lu", ".lv", ".ly", ".ma", ".mc", ".md", ".mg", ".mh", ".mk", ".ml", ".mm", ".mn", ".mo", ".mp", ".mq", ".mr", ".ms", ".mt", ".mu", ".mv", ".mw", ".mx", ".my", ".mz", ".na", ".nc", ".ne", ".nf", ".ng", ".ni", ".nl", ".no", ".np", ".nr", ".nu", ".nz", ".om", ".pa", ".pe", ".pf", ".pg", ".ph", ".pk", ".pl", ".pm", ".pn", ".pr", ".ps", ".pt", ".pw", ".py", ".qa", ".re", ".ro", ".ru", ".rw", ".sa", ".sb", ".sc", ".sd", ".se", ".sg", ".sh", ".si", ".sj", ".sk", ".sl", ".sm", ".sn", ".so", ".sr", ".st", ".su", ".sv", ".sy", ".sz", ".tc", ".td", ".tf", ".tg", ".th", ".tj", ".tk", ".tl", ".tm", ".tn", ".to", ".tp", ".tr", ".tt", ".tv", ".tw", ".tz", ".ua", ".ug", ".uk", ".um", ".us", ".uy", ".uz", ".va", ".vc", ".ve", ".vg", ".vi", ".vn", ".vu", ".wf", ".ws", ".ye", ".yt", ".yu", ".za", ".zm", ".zw" ]
tlds2 = [ ".arpa/", ".root/", ".aero/", ".biz/", ".cat/", ".com/", ".coop/", ".edu/", ".gov/", ".info/", ".int/", ".jobs/", ".mil/", ".mobi/", ".museum/", ".name/", ".net/", ".org/", ".pro/", ".travel/", ".ac/", ".ad/", ".ae/", ".af/", ".ag/", ".ai/", ".al/", ".am/", ".an/", ".ao/", ".aq/", ".ar/", ".as/", ".at/", ".au/", ".aw/", ".az/", ".ba/", ".bb/", ".bd/", ".be/", ".bf/", ".bg/", ".bh/", ".bi/", ".bj/", ".bm/", ".bn/", ".bo/", ".br/", ".bs/", ".bt/", ".bv/", ".bw/", ".by/", ".bz/", ".ca/", ".cc/", ".cd/", ".cf/", ".cg/", ".ch/", ".ci/", ".ck/", ".cl/", ".cm/", ".cn/", ".co/", ".cr/", ".cu/", ".cv/", ".cx/", ".cy/", ".cz/", ".de/", ".dj/", ".dk/", ".dm/", ".do/", ".dz/", ".ec/", ".ee/", ".eg/", ".er/", ".es/", ".et/", ".eu/", ".fi/", ".fj/", ".fk/", ".fm/", ".fo/", ".fr/", ".ga/", ".gb/", ".gd/", ".ge/", ".gf/", ".gg/", ".gh/", ".gi/", ".gl/", ".gm/", ".gn/", ".gp/", ".gq/", ".gr/", ".gs/", ".gt/", ".gu/", ".gw/", ".gy/", ".hk/", ".hm/", ".hn/", ".hr/", ".ht/", ".hu/", ".id/", ".ie/", ".il/", ".im/", ".in/", ".io/", ".iq/", ".ir/", ".is/", ".it/", ".je/", ".jm/", ".jo/", ".jp/", ".ke/", ".kg/", ".kh/", ".ki/", ".km/", ".kn/", ".kr/", ".kw/", ".ky/", ".kz/", ".la/", ".lb/", ".lc/", ".li/", ".lk/", ".lr/", ".ls/", ".lt/", ".lu/", ".lv/", ".ly/", ".ma/", ".mc/", ".md/", ".mg/", ".mh/", ".mk/", ".ml/", ".mm/", ".mn/", ".mo/", ".mp/", ".mq/", ".mr/", ".ms/", ".mt/", ".mu/", ".mv/", ".mw/", ".mx/", ".my/", ".mz/", ".na/", ".nc/", ".ne/", ".nf/", ".ng/", ".ni/", ".nl/", ".no/", ".np/", ".nr/", ".nu/", ".nz/", ".om/", ".pa/", ".pe/", ".pf/", ".pg/", ".ph/", ".pk/", ".pl/", ".pm/", ".pn/", ".pr/", ".ps/", ".pt/", ".pw/", ".py/", ".qa/", ".re/", ".ro/", ".ru/", ".rw/", ".sa/", ".sb/", ".sc/", ".sd/", ".se/", ".sg/", ".sh/", ".si/", ".sj/", ".sk/", ".sl/", ".sm/", ".sn/", ".so/", ".sr/", ".st/", ".su/", ".sv/", ".sy/", ".sz/", ".tc/", ".td/", ".tf/", ".tg/", ".th/", ".tj/", ".tk/", ".tl/", ".tm/", ".tn/", ".to/", ".tp/", ".tr/", ".tt/", ".tv/", ".tw/", ".tz/", ".ua/", ".ug/", ".uk/", ".um/", ".us/", ".uy/", ".uz/", ".va/", ".vc/", ".ve/", ".vg/", ".vi/", ".vn/", ".vu/", ".wf/", ".ws/", ".ye/", ".yt/", ".yu/", ".za/", ".zm/", ".zw/" ]


################################################################################################
################################################################################################
#                                   AOL CORRECTION VARIABLE                                    #
################################################################################################

#  *sigh*

aol = {
        "u": "you",
        "ur": "your",
        "ure": "you're",
        "teh": "the",
        "god": "God",
        "hense": "hence",
        "dont": "don't",
        "doesnt": "doesn't",
        "cant": "can't",
        "youre": "you're",
        "wouldnt": "wouldn't",
        "couldnt": "couldn't",
        "isnt": "isn't",
        "didnt": "didn't",
        "wasnt": "wasn't",
        "hes": "he's",
        "arent": "aren't",
        "hasnt": "hasn't",
        "havent": "haven't",
        "shouldnt": "shouldn't",
        "color": "colour",
        "hadnt": "hadn't",
        "werent": "weren't",
        "cos": "'cause",
        "colors": "colours",
        "dont": "don't",
        "sentances": "sentences",
        "colored": "coloured",
        "english": "English",
        "england": "England",
        "britian": "Britain",
        "british": "British",
        "luv": "love",
        "ppl": "people",
        "r": "are",
        "wat": "what",
        "lyk": "like",
        "ppl": "people",
        "u?": "you?",
        "pls": "please",
        "plz": "please",
        "idk": "I don't know",
        "idc": "I don't care",
        "hav": "have",
        "dis": "this",
        "dat": "that",
        "pliz": "please",
        "pron": "porn",
        "pr0n": "porn",
        "b!tch": "bitch",
        "talkin": "talking",
        "lyke": "like",
        "c": "see",
        "cya": "see you",
        "plez": "please",
        "irl": "in real life",
        "wut": "what",
        "jk": "joke",
        "jw": "just wondering",
        "j00": "you",
        "hows": "how's",
        "ere": "here",
        "waz": "what's",
        "b4": "before",
        "u2": "you too",
        "knoe": "know",
        "sum1": "someone",
        "some1": "someone",
        "no1": "no one",
        "cuz": "because",
        "ppl's": "peoples",
        "g@y": "gay",
        "a$$": "ass",
        "gurl": "girl",
        "taht": "that",
        "y": "why",
        "wot": "what",
        "kool": "cool",
        "becuz": "because",
        "anyware": "anywhere",
        "anywere": "anywhere",
        "der": "there",
        "lke": "like",
        "ik": "I know",
        "wb": "welcome back",
        "myn": "mine",
        "lve": "love",
        "enuf": "enough",
        "finga": "finger",
        "wen": "when",
        "skewl": "school",
        "kewl": "cool",
        "@$$": "ass",
        "belif": "believe",
        "sik": "sick",
        "y?": "why?",
        "im": "I'm",
        "d00d": "dude",
        "d00ds": "dudes",
        "dnt": "don't",
        "every1": "everyone",
        "dam": "damn",
        "cus": "'cause",
        "gav": "gave",
        "wuts": "what's",
        "rly": "really",
        "reli": "really",
        "kno": "know",
        "internet": "Internet",
        "tht": "that",
        "l8tr": "later",
        "nvm": "never mind",
        "werds": "words",
        "thanx": "thanks",
        "guyz": "guys",
        "any1": "anyone",
        "bac": "back",
        "comin": "coming",
        "whateva": "whatever",
        "plzz": "please",
        "baq": "back",
        "thats": "that's",
        "lyfe": "life",
        "smth": "something",
        "whut": "what",
        "promas": "promise",
        "sry": "sorry",
        "tu": "to",
        "yu": "you",
        "muh": "my",
        "boifriend": "boyfriend",
        "gurlfriend": "girlfriend",
        "boi": "boy",
        "smokin": "smoking",
        "ru": "are you",
        "gud": "good",
        "shd": "should",
        "wich": "which",
        "werk": "work",
        "imgud": "i'm good",
        "reson": "reason",
        "excue": "excuse",
        "kech": "catch",
        "ketch": "catch",
        "tho": "though",
        "arnt": "aren't",
        "didn;t": "didn't",
        "btwn": "between",
        "thot": "thought",
        "playa": "player",
        "n1": "nice one",
        "bebbe": "baby",
        "verra": "very",
        "noice": "nice",
        "yur": "you're",
        "ull": "you'll",
        "thru": "through",
        "sayin": "saying",
        "gurd": "good",
        "sbdy": "somebody",
        "kno": "know",
        "j/k": "joke",
        "rong": "wrong",
        "wus": "was",
        "pritty": "pretty",
        "h/o": "hold on",
        "sertin": "certain",
        "srry": "sorry",
        "ne1": "anyone",
        "cryin": "crying",
        "ahppy": "happy",
        "allot": "a lot",
        "otu": "out",
        "goin": "going",
        "moveing": "moving",
        "nomore": "any more",
        "wacthing": "watching",
        "makeing": "making",
        "selfs": "selves",
        "famliy": "family",
        "olny": "only",
        "haev": "have",
        "tryed": "tried",
        "geting": "getting",
        "need2": "need to",
        "lrn": "learn",
        "englis": "english",
        "stopid": "stupid",
        "oic": "oh i see",
        "nvrm": "never mind",
        "wuld": "would",
        "nfi": "no fucking idea",
        "thw": "the",
        "hai": "hi",
        "wutz": "what's",
        "mybe": "maybe",
        "awsum": "awesome",
        "enuff": "enough",
        "tru": "true",
        "thts": "that's",
        "mi": "my",
        "mii": "my",
        "mah": "my",
        "goign": "going",
        "takl": "talk",
        "atkl": "talk",
        "tlak": "talk",
        "itlaialn": "Italian",
        "italian": "Italian",
        "dutch": "Dutch",
        "german": "German",
        "french": "French",
        "spanish": "Spanish",
        "russian": "Russian",
        "pluss": "plus",
        "ralely": "rarely",
        "doncky": "donkey",
        "pplz": "people",
        "inmautre": "immature",
        "mayb": "maybe",
        "idk.": "i don't know",
        "wts": "what's",
        "wht": "what",
        "wtc": "World Trade Centre",
        "wy": "why",
        "gt": "get",
        "skool": "school",
        "cauz": "because",
        "lir": "liar",
        "se": "see",
        "sec": "second",
        "naem": "name",
        "cofusided": "confused",
        "gansta": "gangster",
        "goig": "going",
        "privat": "private",
        "tlk": "talk",
        "wil": "will",
        "tome": "to me",
        "wats": "what's",
        "nvr": "never",
        "azz": "arse",
        "fav": "favourite",
        "evr1": "everyone",
        "ritin": "writing",
        "bout": "about",
        "lik": "like",
        "skool": "school",
        "2day": "today",
        "tellin": "telling",
        "watev": "whatever",
        "whatev": "whatever",
        "thx": "thank you",
        "gonna": "going to",
        "anythin": "anything",
        "alot": "a lot",
        "wen": "when",
        "anymor": "any more",
        "nemor": "any more",
        "nemore": "any more",
        "nemr": "any more",
        "eva": "ever",
        "suk": "suck",
        "reliz": "realise",
        "evry1": "everyone",
        "cussin": "cursing",
        "reeson": "reason",
        "no1s": "no one's",
        "thinx": "thinks",
        "reely": "really",
        "alwayz": "always",
        "ritin": "writing",
        "spellin": "spelling",
        "hav": "have",
        "lik": "like",
        "cuz": "because",
        "peeps": "people",
        "4giv": "forgive",
        "lyer": "liar",
        "thatz": "that's",
        "ursel": "yourself",
        "gunna": "going to",
        "tomorro": "tomorrow",
        "fvcked": "fucked",
        "fvck": "fuck",
        "fvckin": "fucking",
        "boiz": "boys",
        "whats": "what's",
        "wots": "what's",
        "kool": "cool",
        "jking": "joking",
        "slwer": "slower",
        "biger": "bigger",
        "foud": "found",
        "Gday": "g'day",
        "fitest": "fittest",
        "Vauge": "vague",
        "oretending": "pretending",
        "rying": "trying",
        "chaennl": "channel",
        "wednesday": "Wednesday",
        "worndering": "wondering",
        "irridesent": "iridescent",
        "tenderrisor": "tenderiser",
        "beleifs": "beliefs",
        "canaidans": "Canadians",
        "snaort": "snort",
        "wqoman": "woman",
        "nawi": "no way",
        "inverview": "interview",
        "spinaich": "spinach",
        "readdd": "read",
        "debotchery": "debauchery",
        "poatoes": "potatoes",
        "kida": "kind of",
        "sneezeing": "sneezing",
        "suppiriority": "superiority",
        "dne": "done",
        "dns": "DNS",
        "takle": "tackle",
        "migfht": "might",
        "paranoira": "paranoia",
        "simpel": "simple",
        "wana": "want to",
        "wang": "penis",
        "Thinkin": "thinking",
        "dunkin": "dunking",
        "heckuvit": "hell of it",
        "batery": "battery",
        "withcraft": "witchcraft",
        "diiners": "dinners",
        "dna": "do not ask",
        "linecse": "license",
        "ocntract": "contract",
        "Remeber": "remember",
        "eatien": "eaten",
        "treand": "trend",
        "LJ": "LiveJournal",
        "kackban": "kick ban",
        "theproject": "the project",
        "prostitues": "prostitutes",
        "biggots": "bigots",
        "evdaed": "evaded",
        "reasllly": "really",
        "wrond": "wrong",
        "poeit": "poet",
        "balads": "ballads",
        "miis": "miss",
        "adoped": "adopted",
        "Biscunts": "biscuits",
        "arouind": "around",
        "truned": "turned",
        "ro9ck": "rock",
        "willl": "will",
        "uot": "out",
        "Hiz": "his",
        "bulding": "building",
        "realyl": "really",
        "hchilrens": "children's",
        "gtting": "getting",
        "foolin": "fooling",
        "Ushould": "you should",
        "Alot": "a lot",
        "ounze": "ounce",
        "efection": "affection",
        "excepiton": "exception",
        "aparrt": "apart",
        "sudgested": "suggested",
        "stearing": "steering",
        "coservatives": "conservatives",
        "mumpit": "muppet",
        "allah": "Allah",
        "Beged": "begged",
        "imessed": "impressed",
        "kown": "known",
        "batchelor": "bachelor",
        "chowerd": "coward",
        "Irc": "IRC",
        "mabey": "maybe",
        "alway": "always",
        "fil": "fill",
        "yourseld": "yourself",
        "stuicks": "sticks",
        "enviroment": "environment",
        "frenchie": "Frenchie",
        "mattter": "matter",
        "pivk": "pick",
        "sh1tfaced": "shit faced",
        "lazers": "lasers",
        "scoiloius": "scoliosis",
        "kfc": "KFC",
        "bday": "birthday",
        "smight": "smite",
        "oldd": "old",
        "bathropom": "bathroom",
        "ecempt": "exempt",
        "condesending": "condescending",
        "laied": "laid",
        "comapnys": "companies",
        "longi": "long",
        "hsow": "hows",
        "arugeing": "arguing",
        "poiled": "spoiled",
        "profesionally": "professionally",
        "Nuttin": "nothing",
        "thaat": "that",
        "singel": "single",
        "teresa": "Teresa",
        "sayinh": "saying",
        "notbooks": "notebooks",
        "kickbaned": "kick banned",
        "eezy": "easy",
        "haveben": "have been",
        "Pritvate": "private",
        "hippy": "hippie",
        "heres": "here's",
        "ttyl": "talk to you later",
        "qutes": "quotes",
        "liffe": "life",
        "smeels": "smells",
        "easysiet": "easiest",
        "fckers": "fuckers",
        "loook": "look",
        "clenaing": "cleaning",
        "feelins": "feelings",
        "screan": "screen",
        "ticvket": "ticket",
        "neight": "night",
        "apaermtent": "apartment",
        "broekn": "broken",
        "irs": "IRS",
        "irc": "IRC",
        "attcak": "attack",
        "disabiled": "disabled",
        "warching": "watching",
        "lookin": "looking",
        "tomarrow": "tomorrow",
        "nivigating": "navigating",
        "neededy": "needy",
        "watchiong": "watching",
        "disoders": "disorders",
        "mucn": "much",
        "ceoming": "coming",
        "exicuted": "executed",
        "badword": "bad word",
        "stepdad": "stepfather",
        "netwroks": "networks",
        "dreamming": "dreaming",
        "politicuians": "politicians",
        "honeslty": "honestly",
        "allwoed": "allowed",
        "actoins": "actions",
        "aspple": "apple",
        "caplock": "caps-lock",
        "modivation": "motivation",
        "refil": "refill",
        "righttime": "right time",
        "relaly": "really",
        "lasss": "lass",
        "lasst": "last",
        "Grupmy": "grumpy",
        "sometrhing": "something",
        "Phd": "PHD",
        "gruumpy": "grumpy",
        "educatin": "education",
        "muble": "mumble",
        "stareing": "staring",
        "semd": "send",
        "serveer": "server",
        "frut": "fruit",
        "shuldnt": "shouldn't",
        "jusdge": "judge",
        "peachful": "peaceful",
        "wank": "masturbate",
        "barbra": "Barbara",
        "oioi": "oi oi",
        "wales": "Wales",
        "outsorce": "outsource",
        "timeout": "time out",
        "smirf": "Smirf",
        "oprah": "Oprah",
        "jul": "July",
        "sep": "September",
        "jun": "June",
        "lol": "haha!",
        "ok": "OK",
        "omg": "Oh My God",
        "rofl": "Rolling On the Floor Laughing",
        "yep": "yes",
        "jsut": "just",
        "robbie": "Robbie",
        "mom": "mother",
        "skype": "Skype",
        "tv": "TV",
        "wanna": "want to",
        "timeout": "time out",
        "chan": "channel",
        "irc": "IRC",
        "liek": "like",
        "brb": "be right back",
        "v8d": "V8d",
        "anymore": "any more",
        "american": "American",
        "knwo": "know",
        "thats": "that's",
        "online": "on line",
        }
#End of array

caps = {
        "i'm": "I'm",
        "i": "I",
        "i'll": "I'll",
        "i've": "I've"
}
#End of array

html_conversion = {
                   "<": "&lt;",
                   ">": "&gt;",
                   "&": "&amp;"
                   }

punctuation_regexp = "(.*|)((!|\?){3,}|\.{4,})(.*|)"

hostendings = {
               }

hosts_isp_verizon = {
#                     "": ".fios.verizon.net",
                     "Albany, New York": ".albyny.fios.verizon.net",
                     "Auburn, Indiana": ".aubnin.fios.verizon.net",
                     "Buffalo, New York": ".bflony.fios.verizon.net",
                     "Baltimore, Maryland": ".bltmmd.fios.verizon.net",
                     "Boston, Massachusetts": ".bstnma.fios.verizon.net",
                     "Culpeper, Virginia": ".clppva.fios.verizon.net",
                     "Camden, New Jersey": ".cmdnnj.fios.verizon.net",
                     "Concord, New Hampshire": ".cncdnh.fios.verizon.net",
                     "Dallas, Texas": ".dllstx.fios.verizon.net",
                     "Florence, South Carolina": ".flrnsc.fios.verizon.net",
                     "Harrisburg, Pennsylvania": ".hrbgpa.fios.verizon.net",
                     "Houston, Texas": ".hstntx.fios.verizon.net",
#                     "": ".ipslin.fios.verizon.net",
                     "Los Angeles, California": ".lsanca.fios.verizon.net",
                     "Norfolk, Virginia": ".nrflva.fios.verizon.net",
                     "Newark, New Jersey": ".nwrknj.fios.verizon.net",
#                     "": ".nycmny.fios.verizon.net",
#                     "": ".pghkny.fios.verizon.net",
                     "Philadelphia, Pennsylvania": ".phlapa.fios.verizon.net",
                     "Pittsburgh, Pennsylvania": ".pitbpa.fios.verizon.net",
#                     "": ".prvdri.fios.verizon.net",
                     "Portland, Oregon": ".ptldor.fios.verizon.net",
                     "Richmond, Virginia": ".rcmdva.fios.verizon.net",
                     "Seattle, Washington": ".sttlwa.fios.verizon.net",
#                     "": ".syrcny.fios.verizon.net",
                     "Tampa, Florida": ".tampfl.fios.verizon.net",
                     "Washington, DC": ".washdc.fios.verizon.net",
#                     "": ".east.verizon.net",
                     "Albany, New York": ".albyny.east.verizon.net",
                     "Altoona, Pennsylvania": ".altnpa.east.verizon.net",
#                     "": ".atclnj.east.verizon.net",
                     "Buffalo, New York": ".bflony.east.verizon.net",
                     "Baltimore, Maryland": ".bltmmd.east.verizon.net",
                     "Boston, Massachusetts": ".bstnma.east.verizon.net",
                     "Charleston, West Virginia": ".chrlwv.east.verizon.net",
                     "Culpeper, Virginia": ".clppva.east.verizon.net",
                     "Clarksburg, West Virginia": ".clrkwv.east.verizon.net",
                     "Camden, New Jersey": ".cmdnnj.east.verizon.net",
                     "Concord, New Hampshire": ".cncdnh.east.verizon.net",
#                     "": ".hgrtmd.east.verizon.net",
                     "Harrisburg, Pennsylvania": ".hrbgpa.east.verizon.net",
#                     "": ".lyncva.east.verizon.net",
                     "Norfolk, Virginia": ".nrflva.east.verizon.net",
                     "Newark, New Jersey": ".nwrknj.east.verizon.net",
 #                    "": ".nycmny.east.verizon.net",
 #                    "": ".pghkny.east.verizon.net",
                     "Philadelphia, Pennsylvania": ".phlapa.east.verizon.net",
                     "Pittsburgh, Pennsylvania": ".pitbpa.east.verizon.net",
 #                    "": ".prvdri.east.verizon.net",
                     "Portland, Maine": ".ptldme.east.verizon.net",
                     "Richmond, Virginia": ".rcmdva.east.verizon.net",
                     "Roanoke, Virginia": ".ronkva.east.verizon.net",
                     "Scranton, Pennsylvania": ".sctnpa.east.verizon.net",
                     "Salisbury, Maryland": ".slsbmd.east.verizon.net",
                     "Springfield, Massachusetts": ".spfdma.east.verizon.net",
#                     "": ".syrcny.east.verizon.net",
                     "Washington, DC": ".washdc.east.verizon.net",
                     "Baltimore, Maryland": ".balt.east.verizon.net",
#                     "": ".bing.east.verizon.net",
                     "Buffalo, New York": ".buff.east.verizon.net",
#                     "": ".burl.east.verizon.net",
#                     "": ".char.east.verizon.net",
#                     "": ".clrk.east.verizon.net",
#                     "": ".culp.east.verizon.net",
#                     "": ".delv.east.verizon.net",
#                     "": ".fred.east.verizon.net",
                     "Norfolk, Virginia": ".norf.east.verizon.net",
                     "Newark, New Jersey": ".nwrk.east.verizon.net",
#                     "": ".pghk.east.verizon.net",
                     "Philadelphia, Pennsylvania": ".phil.east.verizon.net",
                     "Pittsburgh, Pennsylvania": ".pitt.east.verizon.net",
#                     "": ".port.east.verizon.net",
#                     "": ".prov.east.verizon.net",
#                     "": ".pskn.east.verizon.net",
#                     "": ".rich.east.verizon.net",
#                     "": ".alb.east.verizon.net",
#                     "": ".alt.east.verizon.net",
#                     "": ".atc.east.verizon.net",
#                     "": ".bos.east.verizon.net",
#                     "": ".cap.east.verizon.net",
#                     "": ".esr.east.verizon.net",
#                     "": ".hag.east.verizon.net",
#                     "": ".lyn.east.verizon.net",
#                     "": ".mad.east.verizon.net",
#                     "": ".man.east.verizon.net",
#                     "": ".res.east.verizon.net",
#                     "": ".roa.east.verizon.net",
#                     "": ".sal.east.verizon.net",
#                     "": ".scr.east.verizon.net",
#                     "": ".syr.east.verizon.net",
#                     "": ".wma.east.verizon.net",
#                     "": ".dsl-w.verizon.net",
#                     "": ".atl.dsl-w.verizon.net",
#                     "": ".chi.dsl-w.verizon.net",
#                     "": ".dfw.dsl-w.verizon.net",
#                     "": ".lax.dsl-w.verizon.net",
#                     "": ".sea.dsl-w.verizon.net",
                     "Auburn, Indiana": ".aubnin.dsl-w.verizon.net",
                     "Autsin, Texas": ".austtx.dsl-w.verizon.net",
                     "Dallas, Texas": ".dllstx.dsl-w.verizon.net",
                     "Erie, Pennsylvania": ".eriepa.dsl-w.verizon.net",
                     "Forest City, Illinois": ".frstil.dsl-w.verizon.net",
                     "Grand Rapids, Michigan": ".gdrpmi.dsl-w.verizon.net",
#                     "": ".gdrpwi.dsl-w.verizon.net",
                     "Hearne, Texas": ".herntx.dsl-w.verizon.net",
                     "Harrisburg, Pennsylvania": ".hrbgpa.dsl-w.verizon.net",
#                     "": ".ipslin.dsl-w.verizon.net",
#                     "": ".lsanca.dsl-w.verizon.net",
                     "Madison, Wisconsin": ".mdsnwi.dsl-w.verizon.net",
#                     "": ".plspca.dsl-w.verizon.net",
                     "Portland, Oregon": ".ptldor.dsl-w.verizon.net",
#                     "": ".rlghnc.dsl-w.verizon.net",
#                     "": ".sangtx.dsl-w.verizon.net",
#                     "": ".sbndin.dsl-w.verizon.net",
                     "San Francisco, California": ".snfcca.dsl-w.verizon.net",
#                     "": ".snloca.dsl-w.verizon.net",
                     "Spokane, Washington": ".spknwa.dsl-w.verizon.net",
                     "Seattle, Washington": ".sttlwa.dsl-w.verizon.net",
                     "Tampa, Florida": ".tampfl.dsl-w.verizon.net",
#                     "": ".trrhin.dsl-w.verizon.net",
                     "Washington, DC": ".washdc.dsl-w.verizon.net",
                     "Los Angeles, California": ".lsanca.dsl-w.verizon.net",
#                     "": ".btas.verizon.net",
                     "Scranton, Pennsylvania": ".sctnpa.btas.verizon.net",
                     "Los Angeles, California": ".lsanca.btas.verizon.net",
                     "Washington, DC": "washdc.btas.verizon.net",
                     "Seattle, Washington": ".sttlwa.btas.verizon.net",
                     "Newark, New Jersey": ".nwrknj.btas.verizon.net",
#                     "": ".nycmny.btas.verizon.net",
                     "Camden, New Jersey": ".cmdnnj.btas.verizon.net",
#                     "": ".bdsl.verizon.net",
                     }

hostendings.update(hosts_isp_verizon)


hosts_isp_sbcglobal = {
                       "Abilene, Texas": ".ablntx.sbcglobal.net",
                       "Akron, Ohio": ".akrnoh.sbcglobal.net",
                       "Allen, Texas": ".allntx.sbcglobal.net",
                       "Amarillo, Texas": ".amrltx.sbcglobal.net",
                       "Anaheim, California": ".anhmca.sbcglobal.net",
#                       "": ".applwi.sbcglobal.net",
                       "Arlington Heights, Illinois": ".arlhil.sbcglobal.net",
                       "Austin, Texas": ".austtx.sbcglobal.net",
#                       "": ".bcvloh.sbcglobal.net",
#                       "": ".bltnin.sbcglobal.net",
#                       "": ".brbnca.sbcglobal.net",
#                       "": ".brtlil.sbcglobal.net",
#                       "": ".bumttx.sbcglobal.net",
                       "Chicago, Illinois": ".chcgil.sbcglobal.net",
                       "Champaign, Illinois": ".chmpil.sbcglobal.net",
#                       "": ".chshct.sbcglobal.net",
#                       "": ".chvsca.sbcglobal.net",
#                       "": ".cicril.sbcglobal.net",
#                       "": ".clmboh.sbcglobal.net",
                       "Covell, Illinois": ".covlil.sbcglobal.net",
#                       "": ".crchtx.sbcglobal.net",
#                       "": ".crlsca.sbcglobal.net",
                       "Cyprus, Texas": ".cyprtx.sbcglobal.net",
                       "Dallas, Texas": ".dllstx.sbcglobal.net",
                       "Detroit, Michigan": ".dtrtmi.sbcglobal.net",
                       "Dayton, Ohio": ".dytnoh.sbcglobal.net",
#                       "": ".elpstx.sbcglobal.net",
#                       "": ".emhril.sbcglobal.net",
#                       "": ".enctca.sbcglobal.net",
#                       "": ".euclwi.sbcglobal.net",
#                       "": ".frokca.sbcglobal.net",
                       "Fort Worth, Texas": ".ftwotx.sbcglobal.net",
#                       "": ".fyvlar.sbcglobal.net",
#                       "": ".gdrpmi.sbcglobal.net",
#                       "": ".genvil.sbcglobal.net",
#                       "": ".gylkil.sbcglobal.net",
                       "Harlingen, Texas": ".hrlntx.sbcglobal.net",
                       "Houston, Texas": ".hstntx.sbcglobal.net",
#                       "": ".hvtrmo.sbcglobal.net",
#                       "": ".iplsin.sbcglobal.net",
#                       "": ".ipltin.sbcglobal.net",
                       "Irvine, California": ".irvnca.sbcglobal.net",
#                       "": ".klmzmi.sbcglobal.net",
#                       "": ".kntpin.sbcglobal.net",
#                       "": ".kscyks.sbcglobal.net",
                       "Lancaster, California": ".lacrca.sbcglobal.net",
                       "Lubbock, Texas": ".lbcktx.sbcglobal.net",
#                       "": ".lgtpmi.sbcglobal.net",
                       "Longview, Texas": ".lgvwtx.sbcglobal.net",
#                       "": ".livnmi.sbcglobal.net",
#                       "": ".ltrkar.sbcglobal.net",
                       "McKinney, Texas": ".mckntx.sbcglobal.net",
                       "Midland, Texas": ".mdldtx.sbcglobal.net",
#                       "": ".mdsnwi.sbcglobal.net",
                       "Milwaukee, Wisconsin": ".milwwi.sbcglobal.net",
#                       "": ".mlfrct.sbcglobal.net",
#                       "": ".mnflwi.sbcglobal.net",
#                       "": ".motloh.sbcglobal.net",
#                       "": ".mrdnct.sbcglobal.net",
#                       "": ".mssnks.sbcglobal.net",
#                       "": ".nhllca.sbcglobal.net",
#                       "": ".okcyok.sbcglobal.net",
#                       "": ".orngca.sbcglobal.net",
#                       "": ".oshkwi.sbcglobal.net",
#                       "": ".pcbhca.sbcglobal.net",
#                       "": ".peoril.sbcglobal.net",
#                       "": ".pnblar.sbcglobal.net",
#                       "": ".prtgmi.sbcglobal.net",
#                       "": ".psdnca.sbcglobal.net",
#                       "": ".rcfril.sbcglobal.net",
#                       "": ".rcsntx.sbcglobal.net",
#                       "": ".renocs.sbcglobal.net",
#                       "": ".rlghnc.sbcglobal.net",
                       "Round Rock, Texas": ".ronktx.sbcglobal.net",
#                       "": ".rsbgtx.sbcglobal.net",
#                       "": ".sagsca.sbcglobal.net",
#                       "": ".sbndin.sbcglobal.net",
#                       "": ".sfldmi.sbcglobal.net",
#                       "": ".sgnwmi.sbcglobal.net",
#                       "": ".sjcpca.sbcglobal.net",
                       "San Antonio, Texas": ".snantx.sbcglobal.net",
                       "San Diego, California": ".sndgca.sbcglobal.net",
                       "San Jose, California": ".snjsca.sbcglobal.net",
#                       "": ".snrmca.sbcglobal.net",
                       "Santa Cruz, California": ".sntcca.sbcglobal.net",
#                       "": ".solnoh.sbcglobal.net",
#                       "": ".spfdil.sbcglobal.net",
#                       "": ".spfdmo.sbcglobal.net",
#                       "": ".sprntx.sbcglobal.net",
#                       "": ".stlsmo.sbcglobal.net",
                       "Tomball, Texas": ".tblltx.sbcglobal.net",
#                       "": ".toldoh.sbcglobal.net",
#                       "": ".tpkaks.sbcglobal.net",
#                       "": ".tukrga.sbcglobal.net",
#                       "": ".vcvlca.sbcglobal.net",
                       "Waco, Texas": ".wacotx.sbcglobal.net",
#                       "": ".waynmi.sbcglobal.net",
                       "Wichita Falls, Texas": ".wcfltx.sbcglobal.net",
#                       "": ".wchtks.sbcglobal.net",
#                       "": ".wepbfl.sbcglobal.net",
#                       "": ".wlfrct.sbcglobal.net",
#                       "": ".wlngil.sbcglobal.net",
#                       "": ".wotnoh.sbcglobal.net",
                       "Warren, Michigan": ".wrrnmi.sbcglobal.net",
#                       "": ".wslkoh.sbcglobal.net",
#                       "": ".wtfdct.sbcglobal.net",
#                       "": ".wyndmi.sbcglobal.net",
#                       "": ".yntwoh.sbcglobal.net",
                       }

hostendings.update(hosts_isp_sbcglobal)

hosts_isp_earthlink = {
#                       "": ".cable.earthlink.net",
#                       "": ".accel.atl.earthlink.net",
#                       "": ".accel.pas.earthlink.net",
#                       "": ".atl.sa.earthlink.net",
                       "San Francisco, California": ".ca-sanfranc0.sa.earthlink.net",
                       "Chicago, Illinois": ".il-chicago0.sa.earthlink.net",
                       "Cambridge, Massachusetts": ".ma-cambridg0.sa.earthlink.net",
                       "St Louis, Missouri": ".mo-stlouis0.sa.earthlink.net",
                       "New York, New York": ".ny-newyorkc0.sa.earthlink.net",
#                       "": ".pas.fw.earthlink.net",
                       "Dallas, Texas": ".tx-dallas0.sa.earthlink.net",
                       "Ashburn, Virginia": ".va-ashburn0.sa.earthlink.net",
                       }

hostendings.update(hosts_isp_earthlink)

hosts_isp_comcast = {
                     "Alabama": ".al.comcast.net",
                     "Arkansas": ".ar.comcast.net",
                     "Arizona": ".az.comcast.net",
#                     "": ".bo.comcast.net",
                     "California": ".ca.comcast.net",
                     "Colorado": ".co.comcast.net",
                     "Connecticut": ".ct.comcast.net",
                     "District of Columbia": ".dc.comcast.net",
                     "Delaware": ".de.comcast.net",
                     "Florida": ".fl.comcast.net",
                     "Georgia": ".ga.comcast.net",
                     "Illinois": ".il.comcast.net",
                     "Indiana": ".in.comcast.net",
                     "Kansas": ".ks.comcast.net",
                     "Kentucky": ".ky.comcast.net",
                     "Louisiana": ".la.comcast.net",
                     "Massachusetts": ".ma.comcast.net",
                     "Maryland": ".md.comcast.net",
                     "Michigan": ".mi.comcast.net",
                     "Minnesota": ".mn.comcast.net",
                     "Missouri": ".mo.comcast.net",
                     "Mississippi": ".ms.comcast.net",
                     "North Carolina": ".nc.comcast.net",
                     "New Hampshire": ".nh.comcast.net",
                     "New Jersey": ".nj.comcast.net",
                     "New Mexico": ".nm.comcast.net",
                     "New York": ".ny.comcast.net",
                     "Ohio": ".oh.comcast.net",
                     "Oregon": ".or.comcast.net",
                     "Pennsylvania": ".pa.comcast.net",
                     "South Carolina": ".sc.comcast.net",
                     "Tennessee": ".tn.comcast.net",
                     "Texas": ".tx.comcast.net",
                     "Utah": ".ut.comcast.net",
                     "Virginia": ".va.comcast.net",
                     "Vermont": ".vt.comcast.net",
                     "Washington": ".wa.comcast.net",
                     "Wisconsin": ".wi.comcast.net",
                     "West Virginia": ".wv.comcast.net",
                     }

hostendings.update(hosts_isp_comcast)

hosts_isp_roadrunner = {
#                        "": ".socal.rr.com",
#                        "": ".dialroam.rr.com",
                        "Austin, Texas": ".austin.res.rr.com",
#                        "": ".bak.res.rr.com",
#                        "": ".bham.res.rr.com",
                        "Buffalo, New York": ".buffalo.res.rr.com",
#                        "": ".carolina.res.rr.com",
#                        "": ".central.biz.rr.com",
#                        "": ".cfl.res.rr.com",
#                        "": ".cinci.res.rr.com",
#                        "": ".columbus.res.rr.com",
                        "District of Columbia": ".dc.res.rr.com",
#                        "": ".ec.res.rr.com",
#                        "": ".elmore.res.rr.com",
#                        "": ".elp.res.rr.com",
#                        "": ".eufaula.res.rr.com",
#                        "": ".gt.res.rr.com",
                        "Hawaii": ".hawaii.res.rr.com",
#                        "": ".hot.res.rr.com",
                        "Houston, Texas": ".houston.res.rr.com",
#                        "": ".hvc.res.rr.com",
                        "Texas": ".tx.rr.com",
#                        "": ".indy.res.rr.com",
#                        "": ".insight.res.rr.com",
#                        "": ".res.rr.com",
#                        "": ".jam.res.rr.com",
#                        "": ".kc.res.rr.com",
                        "Maine": ".maine.res.rr.com",
#                        "": ".ma.res.rr.com",
#                        "": ".mass.res.rr.com",
                        "Wisconsin": ".wi.rr.com",
#                        "": ".midsouth.biz.rr.com",
#                        "": ".midsouth.res.rr.com",
#                        "": ".mn.res.rr.com",
#                        "": ".natall.res.rr.com",
#                        "": ".natcky.res.rr.com",
#                        "": ".natmok.res.rr.com",
#                        "": ".natmtn.res.rr.com",
#                        "": ".natnow.res.rr.com",
#                        "": ".natsoe.res.rr.com",
#                        "": ".natsow.res.rr.com",
#                        "": ".natwky.res.rr.com",
#                        "": ".nc.res.rr.com",
#                        "": ".nyroc.rr.com",
#                        "": ".neb.res.rr.com",
#                        "": ".neo.res.rr.com",
#                        "": ".ne.res.rr.com",
#                        "": ".new.res.rr.com",
                        "District of Columbia": ".dc.rr.com",
#                        "": ".nj.res.rr.com",
                        "District of Columbia": ".dc.rr.com",
#                        "": ".nyroc.rr.com",
                        "District of Columbia": ".dc.rr.com",
#                        "": ".nycap.res.rr.com",
                        "New York City, New York": ".nyc.biz.rr.com",
                        "New York City, New York": ".nyc.res.rr.com",
#                        "": ".nys.biz.rr.com",
#                        "": ".panhandle.res.rr.com",
#                        "": ".rgv.res.rr.com",
#                        "": ".rochester.res.rr.com",
#                        "": ".san.res.rr.com",
#                        "": ".satx.res.rr.com",
                        "South Carolina": ".sc.res.rr.com",
#                        "": ".se.biz.rr.com",
#                        "": ".se.res.rr.com",
#                        "": ".res.rr.com",
#                        "": ".si.res.rr.com",
#                        "": ".socal.res.rr.com",
#                        "": ".sport.res.rr.com",
#                        "": ".stny.res.rr.com",
#                        "": ".stx.res.rr.com",
#                        "": ".sw.biz.rr.com",
#                        "": ".swfla.res.rr.com",
#                        "": ".sw.res.rr.com",
                        "Tampa Bay, Florida": ".tampabay.res.rr.com",
#                        "": ".tampbay.res.rr.com",
#                        "": ".triad.res.rr.com",
#                        "": ".twcny.res.rr.com",
#                        "": ".twmi.res.rr.com",
                        "Texas": ".tx.res.rr.com",
#                        "": ".ucwphilly.res.rr.com",
#                        "": ".we.res.rr.com",
#                        "": ".west.biz.rr.com",
                        "Wisconsin": ".wi.res.rr.com",
#                        "": ".woh.res.rr.com",
                        }

hostendings.update(hosts_isp_roadrunner)

localised_hosts = {
                   "United States": ".rr.com",
                   "United States": ".comcast.net",
                   "United States": ".earthlink.net",
                   "United States": ".sbcglobal.net",
                   "United States": ".verizon.net",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
#                   "": "",
                   }

hostendings.update(localised_hosts)

national_hosts = {
                  "Ascension Island": ".ac",
                  "Andorra": ".ad",
                  "United Arab Emirates": ".ae",
                  "Afghanistan": ".af",
                  "Antigua and Barbuda": ".ag",
                  "Anguilla": ".ai",
                  "Albania": ".al",
                  "Armenia": ".am",
                  "Netherlands Antilles": ".an",
                  "Angola": ".ao",
                  "Antarctica": ".aq",
                  "Argentina": ".ar",
                  "American Samoa": ".as",
                  "Austria": ".at",
                  "Australia": ".au",
                  "Aruba": ".aw",
                  "Åland Islands": ".ax",
                  "Azerbaijan": ".az",
                  "Bosnia and Herzegovina": ".ba",
                  "Barbados": ".bb",
                  "Bangladesh": ".bd",
                  "Belgium": ".be",
                  "Burkina Faso": ".bf",
                  "Bulgaria": ".bg",
                  "Bahrain": ".bh",
                  "Burundi": ".bi",
                  "Benin": ".bj",
                  "Saint Barthélemy": ".bl",
                  "Bermuda": ".bm",
                  "Brunei": ".bn",
                  "Bolivia": ".bo",
                  "Brazil": ".br",
                  "Bahamas": ".bs",
                  "Bhutan": ".bt",
                  "Bouvet Island": ".bv",
                  "Botswana": ".bw",
                  "Belarus": ".by",
                  "Belize": ".bz",
                  "Canada": ".ca",
                  "Cocos (Keeling) Islands": ".cc",
                  "Democratic Republic of the Congo": ".cd",
                  "Central African Republic": ".cf",
                  "Republic of the Congo": ".cg",
                  "Switzerland": ".ch",
                  "Côte d'Ivoire (Ivory Coast)": ".ci",
                  "Cook Islands": ".ck",
                  "Chile": ".cl",
                  "Cameroon": ".cm",
                  "People's Republic of China": ".cn",
                  "Colombia": ".co",
                  "Costa Rica": ".cr",
                  "Cuba": ".cu",
                  "Cape Verde": ".cv",
                  "Christmas Island": ".cx",
                  "Cyprus": ".cy",
                  "Czech Republic": ".cz",
                  "Germany": ".de",
                  "Djibouti": ".dj",
                  "Denmark": ".dk",
                  "Dominica": ".dm",
                  "Dominican Republic": ".do",
                  "Algeria": ".dz",
                  "Ecuador": ".ec",
                  "Estonia": ".ee",
                  "Egypt": ".eg",
                  "Western Sahara": ".eh",
                  "Eritrea": ".er",
                  "Spain": ".es",
                  "Ethiopia": ".et",
                  "European Union": ".eu",
                  "Finland": ".fi",
                  "Fiji": ".fj",
                  "Falkland Islands": ".fk",
                  "Federated States of Micronesia": ".fm",
                  "Faroe Islands": ".fo",
                  "France": ".fr",
                  "Gabon": ".ga",
                  "United Kingdom": ".gb",
                  "Grenada": ".gd",
                  "Georgia": ".ge",
                  "French Guiana": ".gf",
                  "Guernsey": ".gg",
                  "Ghana": ".gh",
                  "Gibraltar": ".gi",
                  "Greenland": ".gl",
                  "Gambia": ".gm",
                  "Guinea": ".gn",
                  "Guadeloupe": ".gp",
                  "Equatorial Guinea": ".gq",
                  "Greece": ".gr",
                  "South Georgia and the South Sandwich Islands": ".gs",
                  "Guatemala": ".gt",
                  "Guam": ".gu",
                  "Guinea-Bissau": ".gw",
                  "Guyana": ".gy",
                  "Hong Kong": ".hk",
                  "Heard Island and McDonald Islands": ".hm",
                  "Honduras": ".hn",
                  "Croatia": ".hr",
                  "Haiti": ".ht",
                  "Hungary *": ".hu",
                  "Indonesia": ".id",
                  "Ireland": ".ie",
                  "Israel": ".il",
                  "Isle of Man": ".im",
                  "India": ".in",
                  "British Indian Ocean Territory": ".io",
                  "Iraq": ".iq",
                  "Iran": ".ir",
                  "Iceland": ".is",
                  "Italy": ".it",
                  "Jersey": ".je",
                  "Jamaica": ".jm",
                  "Jordan": ".jo",
                  "Japan": ".jp",
                  "Kenya": ".ke",
                  "Kyrgyzstan": ".kg",
                  "Cambodia": ".kh",
                  "Kiribati": ".ki",
                  "Comoros": ".km",
                  "Saint Kitts and Nevis": ".kn",
                  "North Korea": ".kp",
                  "South Korea": ".kr",
                  "Kuwait": ".kw",
                  "Cayman Islands": ".ky",
                  "Kazakhstan *": ".kz",
                  "Laos": ".la",
                  "Lebanon": ".lb",
                  "Saint Lucia": ".lc",
                  "Liechtenstein": ".li",
                  "Sri Lanka": ".lk",
                  "Liberia": ".lr",
                  "Lesotho ": ".ls",
                  "Lithuania": ".lt",
                  "Luxembourg": ".lu",
                  "Latvia": ".lv",
                  "Libya": ".ly",
                  "Morocco": ".ma",
                  "Monaco": ".mc",
                  "Moldova": ".md",
                  "Montenegro": ".me",
                  "Madagascar": ".mg",
                  "Marshall Islands": ".mh",
                  "Republic of Macedonia": ".mk",
                  "Mali": ".ml",
                  "Myanmar": ".mm",
                  "Mongolia": ".mn",
                  "Macau": ".mo",
                  "Northern Mariana Islands": ".mp",
                  "Martinique": ".mq",
                  "Mauritania": ".mr",
                  "Montserrat ": ".ms",
                  "Malta": ".mt",
                  "Mauritius": ".mu",
                  "Maldives": ".mv",
                  "Malawi": ".mw",
                  "Mexico": ".mx",
                  "Malaysia": ".my",
                  "Mozambique": ".mz",
                  "Namibia": ".na",
                  "New Caledonia": ".nc",
                  "Niger": ".ne",
                  "Norfolk Island": ".nf",
                  "Nigeria": ".ng",
                  "Nicaragua": ".ni",
                  "Netherlands": ".nl",
                  "Norway": ".no",
                  "Nepal": ".np",
                  "Nauru": ".nr",
                  "Niue": ".nu",
                  "New Zealand": ".nz",
                  "Oman": ".om",
                  "Panama": ".pa",
                  "Peru": ".pe",
                  "French Polynesia": ".pf",
                  "Papua New Guinea": ".pg",
                  "Philippines": ".ph",
                  "Pakistan": ".pk",
                  "Poland": ".pl",
                  "Saint Pierre and Miquelon": ".pm",
                  "Pitcairn Islands": ".pn",
                  "Puerto Rico": ".pr",
                  "Palestine": ".ps",
                  "Portugal": ".pt",
                  "Palau": ".pw",
                  "Paraguay": ".py",
                  "Qatar": ".qa",
                  "Réunion": ".re",
                  "Romania": ".ro",
                  "Serbia": ".rs",
                  "Russia": ".ru",
                  "Rwanda": ".rw",
                  "Saudi Arabia": ".sa",
                  "Solomon Islands": ".sb",
                  "Seychelles": ".sc",
                  "Sudan": ".sd",
                  "Sweden": ".se",
                  "Singapore": ".sg",
                  "Saint Helena": ".sh",
                  "Slovenia": ".si",
                  "Svalbard and Jan Mayen islands": ".sj",
                  "Slovakia": ".sk",
                  "Sierra Leone": ".sl",
                  "San Marino": ".sm",
                  "Senegal": ".sn",
                  "Somalia": ".so",
                  "Suriname": ".sr",
                  "São Tomé and Príncipe": ".st",
                  "Soviet Union": ".su",
                  "El Salvador": ".sv",
                  "Syria": ".sy",
                  "Turks and Caicos Islands": ".tc",
                  "Chad": ".td",
                  "French Southern Territories": ".tf",
                  "Togo": ".tg",
                  "Thailand": ".th",
                  "Tajikistan": ".tj",
                  "Tokelau": ".tk",
                  "East Timor": ".tl",
                  "Turkmenistan": ".tm",
                  "Tunisia": ".tn",
                  "Tonga": ".to",
                  "East Timor": ".tp",
                  "Turkey": ".tr",
                  "Trinidad and Tobago": ".tt",
                  "Tuvalu": ".tv",
                  "Taiwan": ".tw",
                  "Tanzania": ".tz",
                  "Ukraine": ".ua",
                  "Uganda": ".ug",
                  "United Kingdom": ".uk",
                  "US Minor Outlying Islands": ".um",
                  "United States": ".us",
                  "Uruguay": ".uy",
                  "Uzbekistan": ".uz",
                  "Vatican City": ".va",
                  "Saint Vincent and the Grenadines": ".vc",
                  "Venezuela": ".ve",
                  "British Virgin Islands": ".vg",
                  "United States Virgin Islands": ".vi",
                  "Vietnam": ".vn",
                  "Vanuatu *": ".vu",
                  "Wallis and Futuna": ".wf",
                  "Samoa (formerly Western Samoa)": ".ws",
                  "Yemen": ".ye",
                  "Mayotte": ".yt",
                  "Yugoslavia": ".yu",
                  "South Africa *": ".za",
                  "Zambia": ".zm",
                  "Zimbabwe": ".zw"
                  }

hostendings.update(national_hosts)

################################################################################################

import string #IGNORE:W0402

def clean_text(text, alphanumeric=False, fix_html=True, true_alphanumeric=False, basic_punct=True):
    '''
    Cleans text of non ascii char's, basically for making it libnotify safe.
    @param text: the text to do all this stuff to.
    @type text: string
    @param alphanumeric: if it should strip anything but abc..ABC..XYZ
    @type alphanumeric: boolean
    @param fix_html: if it should convert various values.
    @type fix_html: boolean
    '''
    if alphanumeric == True:
        if true_alphanumeric == True:
            if basic_punct == True:
                temp = filter((string.letters + string.digits + " !?.,").count, text)
            else:
                temp = filter((string.letters + string.digits).count, text)
        else:
            #Just removes the unprintable stuff.
            temp = filter((string.letters + string.digits + '\`-_[]|^ ').count, text)
    else:
        #Strips everything but letters
        temp = filter((string.printable).count, text)
    if fix_html == True:
        for w in html_conversion:
            temp = temp.replace(w, html_conversion[w])
    
    return temp